<?
$this->breadcrumbs=array(
	Yii::t('yii','Login')
);
?>
<h1>Вход</h1>

<div class="yiiForm">
<?php echo Html::form(); ?>

<?php echo Html::errorSummary($user); ?>

<div class="simple">
<?php echo Html::activeLabel($user,'username'); ?>
<?php echo Html::activeTextField($user,'username') ?>
</div>

<div class="simple">
<?php echo Html::activeLabel($user,'password'); ?>
<?php echo Html::activePasswordField($user,'password') ?>
</div>

<?php echo Html::hiddenField('User[callenge]','',array('id'=>'User_challenge')); ?>

<div class="action">
<?php echo Html::activeCheckBox($user,'rememberMe'); ?> Запомни ме на този компютър<br/>
<?php echo Html::submitButton('Вход'); ?>
</div>

</form>
</div><!-- yiiForm -->
<p>
<?php echo Html::link('Забравена парола?', array('user/recover')); ?>
<br />
Нямате акаунт? <?php echo Html::link('Регистрирайте се', array('user/create')); ?>.
</p>

<script type="text/javascript">
$('form').bind("submit", function() { return false; });

$('form').submit(function () {
	$.getScript('<?php echo Html::jsUrl('sha1.js'); ?>',function(){
		var username = $('#User_username').val();
		var password = $('#User_password').val();
		var challenge = hex_sha1(hex_sha1(hex_md5(password))+username);
		$('#User_password').val('');
		$('#User_challenge').val(challenge);
	}); 	

		$(this).submit();
});
</script>
